package com.like.adapter;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.like.entity.Department;
import com.like.entity.DocListResp;
import com.like.fragment.BaseFragment;
import com.like.fragment.VideoCourseFragment;

import java.util.List;

public class SubjectPagerAdapter extends FragmentPagerAdapter {

    private VideoCourseFragment mVideoFragment = new VideoCourseFragment();
    private VideoCourseFragment mCoursewareFragment = new VideoCourseFragment();
    private VideoCourseFragment mMedicalRecordFragment = new VideoCourseFragment();

    private BaseFragment[] fragments;

    public void initFragments(DocListResp.Doctor doctor) {
        mVideoFragment.setExpert(doctor);
        mVideoFragment.setTypeId(1);
        mCoursewareFragment.setExpert(doctor);
        mCoursewareFragment.setTypeId(2);
        mMedicalRecordFragment.setExpert(doctor);
        mMedicalRecordFragment.setTypeId(3);
    }

    public SubjectPagerAdapter(FragmentManager fm) {
        super(fm);
        fragments = new BaseFragment[]{mVideoFragment, mCoursewareFragment, mMedicalRecordFragment};
    }

    @Override
    public BaseFragment getItem(int position) {
        return fragments[position];
    }

    @Override
    public int getCount() {
        return fragments.length;
    }
}
